import { createRouter, createWebHashHistory } from 'vue-router'
// 使用createWebHashHistory哈希模式 可以避免和后端接口发生冲突,不需要在nginx配置
import '@/assets/base.scss'  //引入base全局样式
import layout from '@/layout/layout.vue'
const routers = [
	{
		name: 'website',
		path: '/website',
		meta: {
			title: '官网',
			hidemenu: true,
			menuType: 1,

		},
		component: () => import('@/views/website/index.vue'),
	},
	{
		name: '小胡今天吃什么',
		path: '/xiaohu',
		meta: {
			title: '小胡今天吃什么',
			hidemenu: true,
			menuType: 1,

		},
		component: () => import('@/views/user/xiaohu.vue'),
	},
	{
		name: 'login',
		path: '/login',
		meta: {
			title: '登录',
			hidemenu: true,
			menuType: 1,

		},
		component: () => import('@/views/login/index.vue'),
	},
	{
		name: 'index', path: '/index', meta: {
			title: '首页',
			icon: 'HomeFilled',
			menuType: 1
		}, redirect: '/home'
	},
	{
		path: '/',
		component: layout,
		redirect: '/user',
		meta: {
			title: '首页',
			icon: 'setting',
			hidemenu: true,
			menuType: 1,

		},
		children: [
			{
				name: 'home',
				path: '/home',
				meta: {
					title: '首页',
					keepalive: false,
					menuType: 1,
				},
				component: () => import('@/components/welcomne.vue'),
			}
		]
	},
	{
		path: '/admin',
		component: layout,
		redirect: '/index',
		meta: {
			title: '系统管理',
			icon: 'setting',
			menuType: 1,

		},
		children: [
			{
				name: 'user',
				path: '/user',
				menuType: 1,
				meta: {
					title: '用户管理',
					keepalive: false,
					icon: 'UserFilled'

				},
				component: () => import('@/views/user/user.vue'),
			},
			{
				name: 'jurisdiction',
				path: '/jurisdiction',
				menuType: 1,
				meta: {
					title: '权限管理',
					keepalive: false,
					icon: 'Share'
				},
				component: () => import('@/views/jurisdiction/index.vue')
			},
			{
				name: 'gaode',
				path: '/gaode',
				menuType: 1,
				meta: {
					title: '高德地图',
					keepalive: false,
					icon: 'Share'
				},
				component: () => import('@/views/gaode/index.vue')
			},
			{
				name: 'selectTree',
				path: '/selectTree',
				menuType: 1,
				meta: {
					title: '树选择',
					keepalive: false,
					icon: 'Share'
				},
				component: () => import('@/views/user/selectUser.vue')
			},
		]
	},
	{
		path: '/link',
		component: layout,
		redirect: '/vue',
		meta: {
			title: '第三方链接',
			icon: 'setting',
			menuType: 1,

		},
		children: [
			{
				name: 'vue',
				path: '/vue',
				menuType: 1,
				meta: {
					title: 'vue中文文档',
					keepalive: false,
					icon: 'UserFilled',
					type: 'iframe',
					link: 'https://v3.cn.vuejs.org'
				},
				component: () => import('@/views/iframe/index.vue')
			},
			{
				name: 'element',
				path: '/element',
				menuType: 1,
				meta: {
					title: '饿了么',
					keepalive: false,
					icon: 'UserFilled',
					type: 'iframe',
					link: 'https://element-plus.gitee.io'
				},
				component: () => import('@/views/iframe/index.vue')
			},
			{
				name: 'vue-router',
				path: '/vue-router',
				menuType: 1,
				meta: {
					title: 'vue路由',
					keepalive: false,
					icon: 'UserFilled',
					type: 'iframe',
					link: 'https://router.vuejs.org/zh/api/'
				},
				component: () => import('@/views/iframe/index.vue')
			},
			{
				name: 'vuex',
				path: '/vuex',
				menuType: 1,
				meta: {
					title: 'vuex',
					keepalive: false,
					icon: 'UserFilled',
					type: 'iframe',
					link: 'https://vuex.vuejs.org/'
				},
				component: () => import('@/views/iframe/index.vue')
			},
			{
				name: 'refresh',
				path: '/refresh',
				menuType: 1,
				meta: {
					title: 'refresh',
					keepalive: false,
					hidemenu: true,
				},
				component: () => import('@/views/refresh/index.js')
			},
		]
	},
]
export function defaultrouter() {// 3. 定义模块私有函数 fn
	return [...routers]
}
const router = createRouter({
	history: createWebHashHistory(),
	routes: routers || []
})

export default router